from rest_framework import serializers

from users.models import User, Addr


class UserSerializer(serializers.ModelSerializer):
    """用户数据序列化器"""

    class Meta:
        model = User
        # 返回的字段
        fields = ('id', 'username', 'last_name', 'mobile', 'email', 'avatar')


class AddrSerializer(serializers.ModelSerializer):
    '''收货地址管理视图'''

    class Meta:
        model = Addr
        fields = "__all__"
